package net.easyjava.tools;

import com.google.code.morphia.Datastore;
import com.google.code.morphia.DatastoreImpl;
import com.google.code.morphia.Morphia;
import com.google.code.morphia.dao.BasicDAO;
import com.google.code.morphia.query.Query;
import com.google.code.morphia.query.QueryImpl;
import com.mongodb.BasicDBObject;
import com.mongodb.Mongo;

import java.util.Map;

/**
 * User: lichao
 * Date: 12-2-7
 * Time: 上午11:32
 */
public class BaseMongoDao<T, K> extends BasicDAO<T, K> {


    public BaseMongoDao(Class<T> entityClass, Mongo mongo, Morphia morphia, String dbName) {
        super(entityClass, mongo, morphia, dbName);
    }



    public BaseMongoDao(Class<T> entityClass, Datastore ds) {
        super(entityClass, ds);
    }



    protected BaseMongoDao(Mongo mongo, Morphia morphia, String dbName) {
        super(mongo, morphia, dbName);
    }



    protected BaseMongoDao(Datastore ds) {
        super(ds);
    }



    public Query<T> createQueryNative(Map json) {
        return new QueryImpl<T>(entityClazz, getCollection(), (DatastoreImpl) getDatastore(), new BasicDBObject(json));
    }





}
